package com.etcfg.etlaunch.ui;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

public class PasteServerAction extends AbstractAction {

	MainWindow mainWindow;

	public PasteServerAction(MainWindow mainWindow) {
		super();
		this.mainWindow = mainWindow;
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P,
				KeyEvent.CTRL_DOWN_MASK));
		putValue(NAME, "Paste");
		putValue(SHORT_DESCRIPTION, "Paste selected server");
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		String clipboardContetnts = mainWindow.getClipboardContetnts();
		AddServerAction addServerAction = mainWindow.getAddServerAction();
		addServerAction.setServerIp(clipboardContetnts);
		addServerAction.actionPerformed(e);
		// connect clanserver.etcfg.com:27960;password letmejoin
	}

}
